# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=korganizer
pkgver=20.04.3
pkgrel=0
arch="all !ppc64le !s390x !armhf !mips !mips64" # Limited by kmailtransport -> libkgapi -> qt5-qtwebengine
url="https://kontact.kde.org/components/korganizer.html"
pkgdesc="The calendar and scheduling component of Kontact"
license="GPL-2.0-or-later"
depends="kdepim-runtime"
makedepends="extra-cmake-modules qt5-qtbase-dev akonadi-search-dev kcodecs-dev
	kcompletion-dev kconfig-dev kconfigwidgets-dev kcoreaddons-dev kcrash-dev
	kdbusaddons-dev kdoctools-dev kiconthemes-dev kitemviews-dev kjobwidgets-dev
	kcmutils-dev knewstuff-dev kparts-dev kservice-dev kwidgetsaddons-dev
	kwindowsystem-dev kxmlgui-dev knotifications-dev kholidays-dev kpimtextedit-dev
	akonadi-dev kcontacts-dev kcalendarcore-dev akonadi-contacts-dev kidentitymanagement-dev
	kmailtransport-dev akonadi-mime-dev kcalutils-dev kldap-dev akonadi-calendar-dev
	phonon-dev kontactinterface-dev kmime-dev akonadi-notes-dev kdepim-apps-libs
	pimcommon-dev libkdepim-dev incidenceeditor-dev calendarsupport-dev eventviews-dev"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/release-service/$pkgver/src/korganizer-$pkgver.tar.xz"
subpackages="$pkgname-doc $pkgname-lang"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	# akonadi-sqlite-koeventpopupmenutest and akonadi-mysql-koeventpopupmenutest
	# require running dbus server
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "akonadi(-sqlite-koeventpopupmenu|-mysql-koeventpopupmenu)test"
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="cc198f650538fabb627564474583cc13a04db1617412eca99b09022e596516bcfc2144cc338cca83ecec7c199066a9fad26cdc955af47764e2c56ed38cdcf70d  korganizer-20.04.3.tar.xz"
